/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmPengirimanBarangKeRuangan.java
 *
 * Created on Jan 25, 2012, 11:36:28 AM
 */
package SIMRS.Apotek.view;

import SIMRS.Apotek.sql.KoneksiDatabase;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import usu.widget.Form;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author yunniie
 */
public class frmPengirimanBarangKeRuangan extends Form {
    private static DefaultTableModel model;
Connection koneksi=KoneksiDatabase.getKoneksi();

    /** Creates new form frmPengirimanBarangKeRuangan */
    public frmPengirimanBarangKeRuangan() {
        initComponents();
        
        model=new DefaultTableModel();
        tblPengirimanBarangKeRuangan.setModel(model);
        model.addColumn("Kode Barang");
        model.addColumn("Nama Barang");
        model.addColumn("Jumlah");
        model.addColumn("Harga Netto");
        
        txtHargaNetto.setEnabled(false);
        
        Date tanggal = new Date();
        txtTanggalKirim.setDate(tanggal);
        
         cmbNamaBarang.addItem("");
        try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select * from obat order by NamaBarang asc");
         rs.beforeFirst();
         while(rs.next()){
             cmbNamaBarang.addItem(rs.getString("NamaBarang"));
         }
         rs.close();
     }
     catch(SQLException ex)
     {
         System.out.println("Error : "+ex);
         }

        
        cmbNamaRuangan.addItem("");
        try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select * from ruangan order by NamaRuangan asc");
         rs.beforeFirst();
         while(rs.next()){
             cmbNamaRuangan.addItem(rs.getString("NamaRuangan"));
         }
         rs.close();
     }
     catch(SQLException ex)
     {
         System.out.println("Error : "+ex);
         }

        
        cmbRuanganTujuan.addItem("");
        try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select * from ruangan order by NamaRuangan asc");
         rs.beforeFirst();
         while(rs.next()){
             cmbRuanganTujuan.addItem(rs.getString("NamaRuangan"));
         }
         rs.close();
     }
     catch(SQLException ex)
     {
         System.out.println("Error : "+ex);
         }
        
        
        cmbPenerima.addItem("");
        try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select * from pegawai order by Nama asc");
         rs.beforeFirst();
         while(rs.next()){
             cmbPenerima.addItem(rs.getString("Nama"));
         }
         rs.close();
     }
     catch(SQLException ex)
     {
         System.out.println("Error : "+ex);
         }
        
        
        setIconImage(new javax.swing.ImageIcon(getClass().getResource("/SIMRS/Apotek/gambar/icon.png")).getImage());
        setTitle(".:: Form Pengiriman Barang Ke Ruangan");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlForm1 = new SIMRS.Apotek.widget.PnlForm();
        label5 = new SIMRS.Apotek.widget.Label();
        cmbNamaRuangan = new javax.swing.JComboBox();
        label6 = new SIMRS.Apotek.widget.Label();
        label1 = new SIMRS.Apotek.widget.Label();
        txtNoOrder = new SIMRS.Apotek.widget.TextBox();
        label3 = new SIMRS.Apotek.widget.Label();
        txtNoKirim = new SIMRS.Apotek.widget.TextBox();
        label7 = new SIMRS.Apotek.widget.Label();
        label9 = new SIMRS.Apotek.widget.Label();
        txtJumlah = new SIMRS.Apotek.widget.TextBox();
        label15 = new SIMRS.Apotek.widget.Label();
        scrollPane1 = new SIMRS.Apotek.widget.ScrollPane();
        tblPengirimanBarangKeRuangan = new SIMRS.Apotek.widget.Table();
        txtTotal = new SIMRS.Apotek.widget.TextBox();
        label8 = new SIMRS.Apotek.widget.Label();
        btnBatal = new SIMRS.Apotek.widget.button2();
        btnHapus = new SIMRS.Apotek.widget.button2();
        btnTambah = new SIMRS.Apotek.widget.button2();
        btnSimpan = new SIMRS.Apotek.widget.button2();
        btnTutup = new SIMRS.Apotek.widget.button2();
        label16 = new SIMRS.Apotek.widget.Label();
        txtTanggalKirim = new com.toedter.calendar.JDateChooser();
        cmbRuanganTujuan = new javax.swing.JComboBox();
        jPanel1 = new javax.swing.JPanel();
        label10 = new SIMRS.Apotek.widget.Label();
        cmbNamaBarang = new javax.swing.JComboBox();
        txtHargaNetto = new SIMRS.Apotek.widget.TextBox();
        kdBarang = new javax.swing.JTextField();
        kdRuangan = new javax.swing.JTextField();
        kdRuanganTujuan = new javax.swing.JTextField();
        cmbPenerima = new javax.swing.JComboBox();
        label2 = new SIMRS.Apotek.widget.Label();
        idPenerima = new javax.swing.JTextField();

        setTitle(".: Form Pengiriman Barang Ke Ruangan");
        setAnimationHide(usu.widget.constan.Animation.HIDE_TO_TOP);
        setAnimationShow(usu.widget.constan.Animation.SHOW_FROM_LEFT);
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        pnlForm1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(57, 190, 53), 3, true));
        pnlForm1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        label5.setText("Nama Ruangan");
        pnlForm1.add(label5, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 130, 100, 20));

        cmbNamaRuangan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbNamaRuanganActionPerformed(evt);
            }
        });
        pnlForm1.add(cmbNamaRuangan, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 150, 150, -1));

        label6.setText("Tanggal Kirim");
        pnlForm1.add(label6, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 130, 90, 20));

        label1.setText("No Order");
        pnlForm1.add(label1, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 130, 60, 20));
        pnlForm1.add(txtNoOrder, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 150, 90, -1));

        label3.setText("No Kirim");
        pnlForm1.add(label3, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 130, 60, 20));

        txtNoKirim.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNoKirimActionPerformed(evt);
            }
        });
        pnlForm1.add(txtNoKirim, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 150, 80, -1));

        label7.setText("Nama Barang");
        pnlForm1.add(label7, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 200, 90, 20));

        label9.setText("Jumlah");
        pnlForm1.add(label9, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 200, 60, 20));
        pnlForm1.add(txtJumlah, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 220, 90, -1));

        label15.setText("Ruangan Tujuan");
        pnlForm1.add(label15, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 130, 100, 20));

        tblPengirimanBarangKeRuangan.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        scrollPane1.setViewportView(tblPengirimanBarangKeRuangan);

        pnlForm1.add(scrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 260, 720, 170));
        pnlForm1.add(txtTotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(620, 440, 120, -1));

        label8.setText("Total");
        pnlForm1.add(label8, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 440, 30, 20));

        btnBatal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/SIMRS/Apotek/gambar/bt_batal.png"))); // NOI18N
        btnBatal.setText("Batal");
        pnlForm1.add(btnBatal, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 480, -1, -1));

        btnHapus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/SIMRS/Apotek/gambar/bt_hapus.png"))); // NOI18N
        btnHapus.setText("Hapus");
        btnHapus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHapusActionPerformed(evt);
            }
        });
        pnlForm1.add(btnHapus, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 200, -1, -1));

        btnTambah.setIcon(new javax.swing.ImageIcon(getClass().getResource("/SIMRS/Apotek/gambar/bt_tambah.png"))); // NOI18N
        btnTambah.setText("Tambah");
        btnTambah.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTambahActionPerformed(evt);
            }
        });
        pnlForm1.add(btnTambah, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 200, -1, -1));

        btnSimpan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/SIMRS/Apotek/gambar/bt_simpan.png"))); // NOI18N
        btnSimpan.setText("Simpan");
        btnSimpan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSimpanActionPerformed(evt);
            }
        });
        pnlForm1.add(btnSimpan, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 480, -1, -1));

        btnTutup.setIcon(new javax.swing.ImageIcon(getClass().getResource("/SIMRS/Apotek/gambar/bt_close.png"))); // NOI18N
        btnTutup.setText("Tutup");
        btnTutup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTutupActionPerformed(evt);
            }
        });
        pnlForm1.add(btnTutup, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 480, -1, -1));

        label16.setForeground(new java.awt.Color(255, 255, 255));
        label16.setText("Pengiriman Barang Ke Ruangan");
        label16.setFont(new java.awt.Font("Tahoma", 1, 18));
        pnlForm1.add(label16, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 50, 400, -1));
        pnlForm1.add(txtTanggalKirim, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 150, 130, -1));

        cmbRuanganTujuan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbRuanganTujuanActionPerformed(evt);
            }
        });
        pnlForm1.add(cmbRuanganTujuan, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 150, 150, -1));

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setOpaque(false);

        label10.setText("Harga Netto");

        cmbNamaBarang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbNamaBarangActionPerformed(evt);
            }
        });

        kdBarang.setForeground(new java.awt.Color(255, 255, 51));
        kdBarang.setBorder(null);
        kdBarang.setFocusable(false);
        kdBarang.setOpaque(false);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(cmbNamaBarang, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(127, 127, 127)
                        .addComponent(txtHargaNetto, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(129, 129, 129)
                        .addComponent(kdBarang, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(98, 98, 98)
                        .addComponent(label10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(331, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(label10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(kdBarang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(cmbNamaBarang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtHargaNetto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(224, Short.MAX_VALUE))
        );

        pnlForm1.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 190, 740, 280));

        kdRuangan.setForeground(new java.awt.Color(255, 255, 51));
        kdRuangan.setBorder(null);
        kdRuangan.setFocusable(false);
        kdRuangan.setOpaque(false);
        pnlForm1.add(kdRuangan, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 130, 80, -1));

        kdRuanganTujuan.setForeground(new java.awt.Color(255, 255, 51));
        kdRuanganTujuan.setBorder(null);
        kdRuanganTujuan.setFocusable(false);
        kdRuanganTujuan.setOpaque(false);
        pnlForm1.add(kdRuanganTujuan, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 124, 60, 20));

        cmbPenerima.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbPenerimaActionPerformed(evt);
            }
        });
        pnlForm1.add(cmbPenerima, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 150, 140, -1));

        label2.setText("Penerima");
        pnlForm1.add(label2, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 130, 70, -1));

        idPenerima.setForeground(new java.awt.Color(255, 255, 51));
        idPenerima.setBorder(null);
        idPenerima.setFocusable(false);
        idPenerima.setOpaque(false);
        pnlForm1.add(idPenerima, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 120, 80, 20));

        getContentPane().add(pnlForm1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 860, 540));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-856)/2, (screenSize.height-563)/2, 856, 563);
    }// </editor-fold>//GEN-END:initComponents

private void txtNoKirimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNoKirimActionPerformed
// TODO add your handling code here:
    System.exit(1);
}//GEN-LAST:event_txtNoKirimActionPerformed

private void btnTutupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTutupActionPerformed
    dispose();
}//GEN-LAST:event_btnTutupActionPerformed

private void cmbNamaRuanganActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbNamaRuanganActionPerformed
// TODO add your handling code here:
    try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select KdRuangan from ruangan where NamaRuangan= '"+cmbNamaRuangan.getSelectedItem().toString()+"'");
         rs.beforeFirst();
         while(rs.next()){
             kdRuangan.setText(rs.getString(1).trim());
         }
         rs.close();
         }
         catch(SQLException ex)
         {
             System.out.println("Error : "+ex);
             }
}//GEN-LAST:event_cmbNamaRuanganActionPerformed

private void cmbRuanganTujuanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbRuanganTujuanActionPerformed
// TODO add your handling code here:
    try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select KdRuangan from ruangan where NamaRuangan= '"+cmbRuanganTujuan.getSelectedItem().toString()+"'");
         rs.beforeFirst();
         while(rs.next()){
             kdRuanganTujuan.setText(rs.getString(1).trim());
         }
         rs.close();
         }
         catch(SQLException ex)
         {
             System.out.println("Error : "+ex);
             }
}//GEN-LAST:event_cmbRuanganTujuanActionPerformed

private void cmbNamaBarangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbNamaBarangActionPerformed
// TODO add your handling code here:
    try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("SELECT obat.KdBarang, hargabarangmedis.HargaNetto1 FROM obat JOIN hargabarangmedis ON (obat.KdBarang=hargabarangmedis.KdBarang) where obat.NamaBarang= '"+cmbNamaBarang.getSelectedItem().toString()+"'");
         rs.beforeFirst();
         while(rs.next()){
             kdBarang.setText(rs.getString(1).trim());
             txtHargaNetto.setText(rs.getString(2).trim());
         }
         rs.close();
         }
         catch(SQLException ex)
         {
             System.out.println("Error : "+ex);
             }
}//GEN-LAST:event_cmbNamaBarangActionPerformed

private void cmbPenerimaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbPenerimaActionPerformed
// TODO add your handling code here:
    try{
         Statement stm = koneksi.createStatement();
         ResultSet rs = stm.executeQuery("select IdPegawai from pegawai where Nama= '"+cmbPenerima.getSelectedItem().toString()+"'");
         rs.beforeFirst();
         while(rs.next()){
             idPenerima.setText(rs.getString(1).trim());
         }
         rs.close();
         }
         catch(SQLException ex)
         {
             System.out.println("Error : "+ex);
             }
}//GEN-LAST:event_cmbPenerimaActionPerformed

private void btnTambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTambahActionPerformed
// TODO add your handling code here:
    String []a=new String[4];
        a[0]=kdBarang.getText();
        a[1]=cmbNamaBarang.getSelectedItem().toString();
        a[2]=txtJumlah.getText();
        a[3]=txtHargaNetto.getText();
        
     model.addRow(a);  
     hitung_total();
}//GEN-LAST:event_btnTambahActionPerformed

private void btnHapusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHapusActionPerformed
// TODO add your handling code here:
    int row=tblPengirimanBarangKeRuangan.getSelectedRow();
    model.removeRow(row); 
}//GEN-LAST:event_btnHapusActionPerformed

private void btnSimpanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSimpanActionPerformed
// TODO add your handling code here:
    Connection c = KoneksiDatabase.getKoneksi();
    if (tblPengirimanBarangKeRuangan.getRowCount() == 0) {
        JOptionPane.showMessageDialog(null, "Data Masih Kosong..!!", "Warning", JOptionPane.INFORMATION_MESSAGE);
    } else {
        try {
            String noKirim = txtNoKirim.getText();
            String noOrder= txtNoOrder.getText();
            String Ruang = kdRuangan.getText();
            SimpleDateFormat Format = new SimpleDateFormat("yyyy-MM-dd");
            String tanggal = Format.format(txtTanggalKirim.getDate());
            String RuangTujuan = kdRuanganTujuan.getText();
            String Penerima= idPenerima.getText();
            
            
            
            
           
            Statement stm = c.createStatement();
           String sql = "insert into strukkirim values('" + noKirim + "','" + tanggal + "','" + noOrder + "','" + Ruang + "','" + RuangTujuan + "','" + Penerima + "')";
          

         stm.executeUpdate(sql);
           

            for (int i = 0; i < tblPengirimanBarangKeRuangan.getRowCount(); i++) {

                    String barang = (String) tblPengirimanBarangKeRuangan.getValueAt(i, 0);
                    String jmlKirim= (String) tblPengirimanBarangKeRuangan.getValueAt(i, 2);
                    String hargaNet= (String) tblPengirimanBarangKeRuangan.getValueAt(i, 3);
                    

                 String sql1 = "insert into pengirimanbarangruangan values('" + noKirim + "','" + barang + "','" + jmlKirim + "','" + hargaNet + "')";

                  stm.executeUpdate(sql1);

                }
            
            JOptionPane.showMessageDialog(this, "Data Berhasil Disimpan");
           
            txtNoKirim.setText("");
            txtNoOrder.setText("");
            txtJumlah.setText("");
            txtHargaNetto.setText("");
            txtTotal.setText("");
            kdBarang.setText("");
            kdRuangan.setText("");
            kdRuanganTujuan.setText("");
            idPenerima.setText("");
            cmbNamaBarang.setSelectedItem("");
            cmbPenerima.setSelectedItem("");
            cmbRuanganTujuan.setSelectedItem("");
            cmbNamaRuangan.setSelectedItem("");
            
            
            
        } catch (SQLException e) {
            System.out.println("Error : " + e);
            JOptionPane.showConfirmDialog(null, "Penginputan Error..!!", ".:Information", JOptionPane.OK_OPTION);
        }
    }

}//GEN-LAST:event_btnSimpanActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private SIMRS.Apotek.widget.button2 btnBatal;
    private SIMRS.Apotek.widget.button2 btnHapus;
    private SIMRS.Apotek.widget.button2 btnSimpan;
    private SIMRS.Apotek.widget.button2 btnTambah;
    private SIMRS.Apotek.widget.button2 btnTutup;
    private javax.swing.JComboBox cmbNamaBarang;
    private javax.swing.JComboBox cmbNamaRuangan;
    private javax.swing.JComboBox cmbPenerima;
    private javax.swing.JComboBox cmbRuanganTujuan;
    private javax.swing.JTextField idPenerima;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField kdBarang;
    private javax.swing.JTextField kdRuangan;
    private javax.swing.JTextField kdRuanganTujuan;
    private SIMRS.Apotek.widget.Label label1;
    private SIMRS.Apotek.widget.Label label10;
    private SIMRS.Apotek.widget.Label label15;
    private SIMRS.Apotek.widget.Label label16;
    private SIMRS.Apotek.widget.Label label2;
    private SIMRS.Apotek.widget.Label label3;
    private SIMRS.Apotek.widget.Label label5;
    private SIMRS.Apotek.widget.Label label6;
    private SIMRS.Apotek.widget.Label label7;
    private SIMRS.Apotek.widget.Label label8;
    private SIMRS.Apotek.widget.Label label9;
    private SIMRS.Apotek.widget.PnlForm pnlForm1;
    private SIMRS.Apotek.widget.ScrollPane scrollPane1;
    private SIMRS.Apotek.widget.Table tblPengirimanBarangKeRuangan;
    private SIMRS.Apotek.widget.TextBox txtHargaNetto;
    private SIMRS.Apotek.widget.TextBox txtJumlah;
    private SIMRS.Apotek.widget.TextBox txtNoKirim;
    private SIMRS.Apotek.widget.TextBox txtNoOrder;
    private com.toedter.calendar.JDateChooser txtTanggalKirim;
    private SIMRS.Apotek.widget.TextBox txtTotal;
    // End of variables declaration//GEN-END:variables

public void isiText(String noOrder, String noKirim, String hrgaNetto, String penerima, String ruang, String ruangTujuan, String nmBarang, String jmlh, Date a, String tot){
  txtNoOrder.setText(noOrder);
  txtNoKirim.setText(noKirim);
  txtHargaNetto.setText(hrgaNetto);
  cmbPenerima.setSelectedItem(penerima);
  cmbNamaRuangan.setSelectedItem(ruang);
  cmbRuanganTujuan.setSelectedItem(ruangTujuan);
  cmbNamaBarang.setSelectedItem(nmBarang);
  txtJumlah.setText(jmlh);
  txtTanggalKirim.setDate(a);
//  txtTotal.setText(tot);
  
}

private void hitung_total()
    {
       
        int jml, hrga, xtot, total;
      
        jml = Integer.parseInt(txtJumlah.getText());
        hrga=Integer.parseInt(txtHargaNetto.getText());
       xtot = jml*hrga;
       String xjml = Integer.toString(xtot);
        txtTotal.setText(xjml);
        tblPengirimanBarangKeRuangan.getCellRenderer(jml, 3);
        
    }

}
